package com.didispace.web;

import com.didispace.service.ComputeClientForOpenFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConsumerController {

    @Autowired
    ComputeClientForOpenFeign computeClientForOpenFeign;

    @Autowired
    ComputeApi computeApi;

    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public Integer add() {
        return computeClientForOpenFeign.add(10, 20);
    }

    @RequestMapping(value = "/addFeign", method = RequestMethod.GET)
    public Integer addFeign() {
        return computeApi.addFeign(10, 20);
    }

    @RequestMapping(value = "/throwsBizException")
    public Integer throwsBizException(){
        return computeApi.throwsBizException();
    }

}
